package herd;

import algorithm.AlgorithmParameters;
import utils.Position;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Randomizer {
    private static final Random ran = new Random(44);

    public List<Krill> randomizeHerd(AlgorithmParameters algorithmParameters){
        List<Krill> herd = new ArrayList<Krill>(algorithmParameters.herdSize);

        for (int i = 0; i < algorithmParameters.herdSize; i++) {
            herd.add(randomKrill(algorithmParameters.minPosition, algorithmParameters.maxPosition));
        }

        return herd;
    }

    //CHANGE THIS ASAP!!!
    public Food randomizeFood(){
        return new Food();
    }

    private Krill randomKrill(Position minPosition, Position maxPosition){
        double poz_x = (ran.nextDouble() * (minPosition.getX() - maxPosition.getX())) + maxPosition.getX();
        double poz_y = (ran.nextDouble() * (minPosition.getY() - maxPosition.getY())) + maxPosition.getY();
        Position position = new Position(poz_x,poz_y);

        return new Krill(position);
    }
}
